/******************************************************************************
*
*  Copyright (C), 2018, Eugene.Chan placetobe@163.com
*
 -----------------------------------------------------------------------------
* @file          : d_io.h
* @brief         : input output control
*
* @author        : eugeneChan
* @mail          : placetobe@163.com
* @date          : 2018/10/10
* @version       : 0.0.0.1
* @license       : GNU General Public License (GPL)
*
* -----------------------------------------------------------------------------
* Change History :
* <Date>     |  <Version>  |  <Author>    |  <Description>
* 2018/10/10  |  0.0.0.01   |  eugeneChan |  Create File
*
******************************************************************************/

#ifndef __D_IO_H__
#define __D_IO_H__


#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

/* include files ------------------------------------------------------------*/

/* constans & micro ---------------------------------------------------------*/
#define OUT_AFIO        (GPIO_PB)
#define OUT_GPIO       (HT_GPIOB)
#define OUT_PIN        (GPIO_PIN_3)
#define OUT_OFF        {GPIO_ClearOutBits(OUT_GPIO, OUT_PIN);}
#define OUT_ON         {GPIO_SetOutBits(OUT_GPIO, OUT_PIN);}

#define OUTR_AFIO      (GPIO_PB)
#define OUTR_GPIO      (HT_GPIOB)
#define OUTR_PIN      (GPIO_PIN_2)
#define OUTR_OFF      {GPIO_ClearOutBits(OUTR_GPIO, OUTR_PIN);}
#define OUTR_ON       {GPIO_SetOutBits(OUTR_GPIO, OUTR_PIN);}


#define SMK_AFIO    (GPIO_PA)
#define SMK_GPIO    (HT_GPIOA)
#define SMK_PIN (GPIO_PIN_9)
#define SMK_EXTI_CHANNEL    (9)

#define CLRK_AFIO   (GPIO_PA)
#define CLRK_GPIO    (HT_GPIOA)
#define CLRK_PIN    (GPIO_PIN_0)
#define CLRK_EXTI_CHANNEL    (0)

// ???????? PA9 & PA0
#define SMK_PRESS           0x001
#define CLK_PRESS           0x100
#define ALL_KEY_RELEASE    0x101
/* data types ---------------------------------------------------------------*/

/* global variables ---------------------------------------------------------*/

/* function prototypes ------------------------------------------------------*/
extern void d_input_deinit(void);
extern void d_input_init(void);
extern void d_output_deinit(void);
extern void d_output_init(void);
extern void d_key_scan(void);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* __D_IO_H__ */
